package com.example.demo.controller;

import com.example.demo.pojo.Member;
import com.example.demo.service.MemberService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

@Controller
public class IndexController {

    @Resource
    private MemberService memberService;

    @RequestMapping("/list")
    @ResponseBody
    public List<Member> getMemberList(){
        return memberService.queryMemberById();
    }

    @RequestMapping("")
    public String index(){
        return "/index";
    }

    @RequestMapping("/hello")
    public String hello(Model model){
        model.addAttribute("hello","欢迎来到志愿者管理后台");
        return "/hello";
    }

    @RequestMapping("/admin")
    public String admin(){
        return "/admin";
    }


    @RequestMapping("/select")
    public String select(){return "/select";}

    @RequestMapping("/dept")
    public String dept(){return "/dept";}
}
